package edu.Pta;

import java.util.Scanner;

public class ptaDemo2{
    public static void main(String[] args) {
            int T, times;//起始时间和流逝时间
            Scanner s = new Scanner(System.in);
            T = s.nextInt();
            times = s.nextInt();//有正负
            int t1 = times / 60;//小时数
            int t2 = times % 60;//分钟数
            if (T / 1000 > 0) {
                int o = (t2 + T % 100) / 60;
                int T2 = (T % 100 + t2) % 60;
                int T1 = (((T + t1 * 100 + o * 100) / 100 * 100) + T2) % 2400;
                if (T1 / 100 == 0) {
                    System.out.printf("%3d", T1);
                } else {
                    System.out.println(T1);
                }
            }
    }
}